<template>
	<view>
		<web-view :src="url"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//需要显示的PDF链接
				url: ""
			}
		},
		onLoad(options) {
			// this.setData({
			// 	url: this.$httpurl + '/yw/help/downloadHelp'
			// })
			this.checkPhone(this.$httpurl + '/yw/help/downloadHelp')
		},
		onShow() {},
		methods: {
			checkPhone(url) {
				let _this = this;
				wx.getSystemInfo({
					success: function(res) {
						//判断当前机型
						/*
			        if (res.system.indexOf('iOS')!=-1){
			          _this.setData({
			            url: url
			          })
			        }else{*/
						// _this.setData({
						// 	ios: false
						// })
						wx.downloadFile({
							url: url,
							header: {
								'content-type': 'application/json;charset=UTF-8', // 默认值
								'userId': app.data.userId,
								'sdpc-token': app.data.token,
								'token': app.data.token
							},
							success(res) {
								let path = res.tempFilePath;
								wx.openDocument({
									filePath: path,
									fileType: "pdf",
									success(e) {
										wx.navigateBack({
											delta: 1
										})
									}
								})
							}
						})
						/*
			        }*/
					},
				})
			}
		}
	}
</script>

<style>
</style>
